﻿using Common.Views;
using Core.Domain.Model;
using NUnit.Framework;
using Sanelib.Common.Helpers;
using Sanelib.DataView;

namespace IntegrationTests.ViewModel
{
    public class TempleteViewRepositoryTester : IntegrationTestBase
    {
        [Test]
        public void ShouldAddTempleteView()
        {
            var templete = new Templete
            {
                Id = GuidComb.New(),
                Name = "TempleteName",
                Value = "TempleteValue"
            };

            Persist(templete);

            var repo = GetInstance<IViewRepository<TempleteView>>();
            var templeteView = repo.GetByKey(Property.Of<TempleteView>(x => x.Id), templete.Id);

            Assert.AreEqual(templeteView.Id, templete.Id);
            Assert.AreEqual(templeteView.Name, templete.Name);
            Assert.AreEqual(templeteView.Value, templete.Value);
        }
    }
}